<template>
  <view class="u-p-l-30 u-p-r-30">
    <study_list :datas="showList"></study_list>
    <u-loadmore :status="status" />
  </view>
</template>

<script>
  import study_list from "./study_list";
  import {request} from "../../../util/api";
  export default {
    name: "",

    onLoad(option) {
      this.typeName = option.name
      uni.setNavigationBarTitle({
        title: option.name
      });
    },

    data() {
      return {
        typeName: '',
        status: 'loadmore',
        list: [],
        showList: []
      }
    },

    components: {
      study_list
    },

    mounted() {
      this.getList()
    },

    methods: {
      getList() {
        this.status = 'loading'
        request({
          url: '/system/wx/CompassCaseStudy/list',
          token: true,
          data: {
            pageNum: 1,
            pageSize: 999
          }
        }).then(res=> {
          this.list = this.list.concat(res.rows)
          this.showList = this.list.filter(item => item.exampleType === this.typeName)
          if (this.list.length < res.total) {
            this.status = 'loadmore'
          } else {
            this.status = 'more'
          }
        })
      },
    }
  }
</script>

<style scoped>

</style>
